/**
* 
* ====================================================================
*
* @author apov <apov@ymail.com>
*/ 
#pragma once

#include "DBResultSet.h"
#include "ODBC_DBSession.h"
#include "DBLibs.h"
#include <LumpData.h>

class ODBC_DBPrepareStatement;
/**
* @class ODBC_DBResultSet
*  - 
*/ 
class ODBC_DBResultSet : public DBResultSet{
	enum{
		DEF_DATA_BUF_SIZE=		9000,
		DEF_MAX_COL_NAME_SIZE=	512,

		DEF_NULL_TYPE_STR_SIZE=		100,
		DEF_DATE_STR_SIZE=			50,
	};

public:
	virtual int next();
	virtual void reset();

	virtual size_t getAffectedCount();
	
	virtual char getByte();
	virtual short get2Byte();
	virtual int get4Byte();
	virtual __int64 get8Byte();
	virtual int getString( char* buffer, size_t size );
	virtual int getMemory( char* buffer, size_t size );
	virtual double getFloat();

	virtual int get_resultset_desc( void* handle, DBTableDescription& table_desc );

	int setByte( char* data );
	int set2Byte( short* data );
	int set4Byte( int* data );
	int set8Byte( __int64* data );
	int setString( char* data, size_t size );
	
	ODBC_DBResultSet();
	virtual ~ODBC_DBResultSet();	

protected:

private:	
	friend class ODBC_DBStatement;

	int makeHandle( DBSession* session, int result_type );	

	SQLHSTMT stmt_;
	
	int current_result_col_pos_;	
	int result_type_;
	int bind_col_idx_;
};
